package com.tianya.scheduled.controller;


import com.tianya.scheduled.common.ListWrapper;
import com.tianya.scheduled.common.Page;
import com.tianya.scheduled.common.Result;
import com.tianya.scheduled.model.CronExpression;
import com.tianya.scheduled.service.CronExpressionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tianya
 * @since 2021-05-21
 */
@RestController
@RequestMapping("/cron-expression")
@Api(value = "CronExpressionController是一个用于对Cron进行操作的控制器")
public class CronExpressionController {

    @Autowired
    private CronExpressionService cronExpressionService;

    @PostMapping("/query")
    @ApiOperation(value = "分页查询cron表达式")
    public Result<ListWrapper<CronExpression>> query(@RequestBody Page page){

        return Result.succeed(cronExpressionService.query(page));
    }
}
